
package com.market.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;

import com.market.bean.Msgboard;

public class MsgBoardServiceImpl extends BaseServiceImpl implements IMsgBoardService
{
    /*
     * (non-Javadoc)
     * 
     * @see com.market.service.IMsgBoardService#findMsg(int, int)
     */
    public List findMsg(int start, int max)
    {
        DetachedCriteria detachCri = DetachedCriteria.forClass(Msgboard.class);
        detachCri.addOrder(Order.desc("asdate"));
        return getMsgboardDAO().findByDetchedCriteria(detachCri, start, max);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.market.service.IMsgBoardService#getMsgCount()
     */
    public int getMsgCount()
    {
        DetachedCriteria detachCri = DetachedCriteria.forClass(Msgboard.class);
        return getMsgboardDAO().getCountByDetachedCriteria(detachCri);
    }

    public Msgboard findById(int id)
    {
        // TODO Auto-generated method stub
        return getMsgboardDAO().findById(id);
    }

}
